/*
 *               ____
 *              /\   \
 *             ___\   \___
 *            /\          \
 *            \ \___    ___\
 *        ____ \/__/\   \__/
 *       /\   \    \ \___\    klof  |  innovative web technology
 *      ___\   \___ \/___/
 *     /\          \          klib3/debug.js
 *     \ \___    ___\         Provide easy debugging (inspired by tools found on the net)
 *      \/__/\   \__/
 *          \ \___\           Copyright 2003-2006, klof
 *           \/___/           http://www.klof.net/k.lib3/
 *
 */


/* Create the master klib3 object if she doesn't exist */
if ( typeof klib3 != "object" )
	klib3 = new ( function(){ this._child = 0 } )();



klib3.debug = function()
{
	this._version = "1.0.0";
};
klib3.debug.prototype.dump = function( mVariable, sIndent )
{
	var sReturn = "";
	sIndent     = ( typeof sIndent != "string" ? "" : sIndent );
	if ( typeof mVariable == "function" )
	{
		sReturn += "[function]";
	}
	else if ( typeof mVariable == "object" )
	{
		var sOpen  = "Object:{";
		var sClose = "}";
		if ( mVariable.__proto__ == Array.prototype )
		{
			sOpen  = "Array:[";
			sClose = "]";
		}
		sReturn += sOpen + "\n";
		for ( var p in mVariable )
			sReturn += "\t" + sIndent + p + ":" + ( arguments.callee( mVariable[ p ], "\t" ) ) + "\n";
		sReturn += sIndent + sClose;	
	}
	else
	{
		sReturn += ( typeof mVariable == "string" ? "'" + mVariable + "'" : mVariable );
	}
	return sReturn;
};

// construct the klib3.debug Object onto itself so we have access to it's members
klib3.debug = new klib3.debug;
